<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed');
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <iframe name="goods_execl_file" style="display:none;"></iframe>
                            <style>
                            .execl_goods_a{display:inline-block; width:100px; height:40px; background:red; position:relative; overflow:hidden;}
                            .goods_execl_file{position:absolute; right:0; top:0; font-size:100px; opacity:0; filter:alpha(opacity=0);}
                            </style>
                            <form class="form-inline" target="goods_execl_file" action="{:U('goods/exportGoodsExecl')}" style=" padding: 0px 5px; float:left" method="POST" enctype="multipart/form-data">
                                <a href="#" class="execl_goods_a btn btn-info">商品导入
                                <input type="file" name="execl_goods" class="goods_execl_file">
                                </a>
                            </form>
                            <form class="form-inline" action="{:U('index')}" style=" padding: 0px 5px; float:left" method="get">
                                <a class="btn btn-info" href="{:U('add')}" value="">新增</a>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <label class="inline">商品搜索</label>
                                <input type="text" name="keyword" value="{$sh.keyword}" class="form-control" size="20">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <label class="inline">earn13</label>
                                <input type="text" name="sku" value="{$sh.sku}" class="form-control" size="15">
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">商品类别</label>
                                    <input type="hidden" id="goods_type" value="{$sh.goods_type_id}">
                                     <select id='goods_type_id' name="goods_type_id" class="rcol-xs-8 col-sm-9">
                                                        <option value="0">请选择商品类别</option>
                                                        <notempty name="localstore">
                                                        {$select_option_list}
                                                       </notempty> 
                                     </select>
                                </div>
								&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </button>
                            </form>
                        </div>
                        <script>
                            var title = '';
                            var code  = '';
                            
                                
                            $('.goods_execl_file').change(function(){
                                swal({
                                        title: "",
                                        text: '<div class="sk-spinner sk-spinner-three-bounce"><div class="sk-bounce1"></div><div class="sk-bounce2"></div><div class="sk-bounce3"></div></div>',
                                        html: true,
                                        showConfirmButton: false 
                                });
                                $(this).closest('form').submit();
                            });
                            function tips_msg() {
                                swal({
                                    title: "",
                                    text: title,
                                    type : code,
                                    html: true
                                });
                            }
                        </script>
                        <div class="space-4"></div>
                        <style>
                            .goodslist{font-size: 10px;}
                        </style>
                        <div class="row" style=" margin-bottom:10px;">
                            <div class="col-sm-12">
                                <div class="infobox infobox-pink">
                                    <div class="infobox-icon">
                                        <i class="ace-icon fa fa-shopping-cart"></i>
                                    </div>
                                    <div class="infobox-data">
                                        <span class="infobox-data-number">{$total}</span>
                                        <div class="infobox-content">产品总数</div>
                                    </div>
                                </div>
                                <div class="infobox infobox-pink">
                                    <div class="infobox-icon">
                                        <i class="ace-icon fa fa-shopping-cart"></i>
                                    </div>
                                    <div class="infobox-data">
                                        <span class="infobox-data-number">{$supply_total}</span>
                                        <div class="infobox-content">供应商总数</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <form id="form" method="post" action="{:U('goodsBath')}">
                                <table class="table table-striped table-bordered table-hover goodslist" >
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th width="100px">商品en13</th>
                                        <th width="260px">商品名称</th>
                                        <th>品牌</th>
                                        <th width="90px">类别</th>
                                        <th>供应库存</th>
                                        <th>供应商家数量</th>
                                        <th>原产国</th>
                                        <th>贸易类型</th>
                                        <th class="center" width="100" >操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                               <input class="ids" type="checkbox" name="ids[]" value="{$val['id']}">
                                            </td>
                                            <td>{$val['earn13']}</td>
                                            <td>{$val['name']}</td>
                                            <td>{$val['brand_name']}</td>
                                            <td>{$val['type_name']}</td>
                                            <td>{:getGoodsSupplyStockTotal($val['id'])}</td>
                                            <td>{:getGoodsSupplyTotal($val['id'])} / <a href="{:U('Supply/productList' , array('status' => 2 , 'goods_id' => $val['id']))}">查看供应列表</a></td>
                                            <td>{$val['chinese_name']}<?php if($val['country_enabled']=='true' && $val['chinese_name']):?><i class="ace-icon fa fa-check bigger-100"></i><?php elseif($val['country_enabled']=='true'):?>
                                                <i class="ace-icon  fa fa-times"></i><?php endif;?>
                                            </td>

                                            <td>{$val['trade_type']}{$tradeList[$val['trade_type']]}</td>
                                            <td class="center"><a href="{:U('edit' , array('id' => $val['id']))}">修改</a>&nbsp;
                                               <a class="del" href="javascript:;"
                                                                                     val="{:U('del'  , array('id' => $val['id']))}"
                                                                                     title="删除">删除</a>
                                            </td>
                                        </tr>
                                    </volist>
                                    
                                    </tbody>
                                </table>
                            </form>
                        </div>
                        <div class="cf">
							<input id="submit_sh" class="btn btn-info" type="button" value="一键删除">
						</div>
                        {$page}
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        var goods_type_id = $('#goods_type').val();
        if(goods_type_id){
            $('#goods_type_id option').each(function(){
                  if( goods_type_id == $(this).attr('value') ) {
                      $(this).attr('selected' , true);
                      return false;
                  } 
               }); 
        }
         
      


        $(".check-all").click(function () {
            $(".ids").prop("checked", this.checked);
        });
        $('#submit_sh').click(function(){
			var _self = $('input.ids:checked');
			if( _self.length <= 0 ) {
				swal('请勾选要删除的数据' , '' , 'error');
				return false;
			}
			var ids = '';
			_self.each(function(){ ids+=','+$(this).val(); });
			location.href="/index.php/Goods/del/id/"+ids.substr(1)+".html";
		});
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该商品?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
